Python: Allow OpenAI function results without call IDs - #7928
Python: Allow OpenAI function results without call IDs#7928mikemikimike wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Allows OpenAI Responses API function results to omit call_id instead of serializing it as null.
Changes:
- Makes
Content.from_function_resultaccept an optional call ID. - Conditionally serializes
call_id. - Adds regression tests for ID-less results.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
python/packages/core/agent_framework/_types.py |
Makes result call IDs optional. |
python/packages/core/tests/core/test_types.py |
Tests ID-less result construction. |
python/packages/openai/agent_framework_openai/_chat_client.py |
Omits absent IDs from Responses payloads. |
python/packages/openai/tests/openai/test_openai_chat_client.py |
Tests serialization with no call ID. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
This is now handled differently because of a previously merged PR (#7988), please check if that does not overlap here. mikemikimike |
|
Closing this PR rather than merging it because #7988 established a different core identity contract:
Making Issue #7922 remains open for a Responses-specific redesign. That work should first establish which id-less wire combinations the service accepts, then represent those fields at the Responses boundary without making anonymous function results executable or generally valid in Agent Framework core. The scenario row added here should be designed with that complete contract rather than merged as an isolated exception. |
Motivation & Context
The OpenAI Responses API permits
function_call_outputitems without acall_id, but Agent Framework currently requires one when constructing function-result content and serializes an absent value as"call_id": null. This makes adapting OpenAI-compatible SDK payloads unnecessarily difficult.Description & Review Guide
Content.from_function_resultnow accepts an omitted call ID, and the OpenAI Responses serializer only includescall_idwhen one is provided.packages/openai/tests/openai/test_openai_chat_client.py.mcp,agent-hooks, and related workspace packages that are not installed in this checkout.Related Issue
Fixes #7922
Contribution Checklist